/*
 * $Id$
 *
 * Copyright 2006- Revolution Health Group.  All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of Revolution Health Group.  (Confidential Information).
 * You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license 
 * agreement you entered into with Revolution Health Group.
 *
 */
package org.javason.jsonrpc;

import java.util.*;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;

import org.javason.exception.JsonRpcServiceException;
import org.javason.jsonrpc.JsonBean.TEST_TYPE;

public class JsonInterface {
	public JsonBean doSomething(JsonBean input) {
		System.out.println("doSomething bean = " + ReflectionToStringBuilder.toString(input));
		input.setTest("came in");
		input.setTestType(TEST_TYPE.testing);
		return input;
	}
	
	//public List<TestJsonBean> getEnumType() {
	public JsonBean[] getEnumType() {
		JsonBean input = new JsonBean();
		input.setTest("came in");
		input.setTestType(TEST_TYPE.testing);
		input.setTestStrings(Arrays.asList("something"));
		return Arrays.asList(input).toArray(new JsonBean[0]);
	}
	
	public String testArray(List<Integer> integerArray) {
		String result = "";
		for (Integer iter : integerArray) {
			System.out.println("int value = " + iter);
			result += " " + iter;
		}
		return "integerArray = " + result;
	}
	
	public String testArray2(List<String> strArray) {
		String result = "";
		for (String iter : strArray) {
			System.out.println("str value = " + iter);
			result += " " + iter;
		}
		return "strArray = " + result;
	}
	
	public void testArray3(List<JsonBean2> testJsonBean2Array) {
		for (JsonBean2 iter : testJsonBean2Array) {
			System.out.println("value = " + ReflectionToStringBuilder.toString(iter));
		}
	}
	
	public JsonBean3 testJaxBArray(JsonBean3 testBean3) {
		System.out.println("testBean3 = " + testBean3);
		assert testBean3.getTestArray().get(0).equals("String Here");
		return testBean3;
	}
	
	public void testException() {
		throw new JsonRpcServiceException(99, "the message", new IllegalArgumentException());
	}
	
	public Float testFloat() {
		return (float)1.1;
	}
}
